import service from "@/request";
import { queryInt, resInt } from "../type";
import { exportUserInt, getUserInt, userFormInt } from "./type";

/**
 * 获取人员接口
 */
export const getUserApi = (data: getUserInt) => {
  return service({
    url: "/user",
    method: "get",
    params: data,
  });
};

/**
 * 添加人员
 * @param data 
 * @returns 
 */
export const addUserApi=(data: userFormInt)=>service.post<any, resInt<string>>('/user', data)

/**
 * 修改管理员信息
 * @param data 
 * @returns 
 */
export const editUserApi=(data: userFormInt)=>{
  return service<any, resInt<object>>({
    url: "/user",
    method: "put",
    data,
  });
}

/**
 * 删除人员
 * @param id
 * @returns
 */
export const delUserApi = (id: number) => service.delete<any, resInt<string>>(`/user/${id}`);

/**
 * 导出表格
 * @param data 
 * @returns 
 */
export const exportUserApi=(data:exportUserInt)=>{
  return service({
    url: "/user",
    method: "get",
    responseType: "blob",
    params: data,
  })
}